home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / contrib / pdcurs22 / src / portable / getyx.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-26  |  5.5 KB  |  169 lines

  1. /*
  2. ***************************************************************************
  3. * This file comprises part of PDCurses. PDCurses is Public Domain software.
  4. * You may use this code for whatever purposes you desire. This software
  5. * is provided AS IS with NO WARRANTY whatsoever.
  6. * Should this software be used in another application, an acknowledgement
  7. * that PDCurses code is used would be appreciated, but is not mandatory.
  8. *
  9. * Any changes which you make to this software which may improve or enhance
  10. * it, should be forwarded to the current maintainer for the benefit of 
  11. * other users.
  12. *
  13. * The only restriction placed on this code is that no distribution of
  14. * modified PDCurses code be made under the PDCurses name, by anyone
  15. * other than the current maintainer.
  16. * See the file maintain.er for details of the current maintainer.
  17. ***************************************************************************
  18. */
  19. #define    CURSES_LIBRARY    1
  20. #include <curses.h>
  21.  
  22. /* undefine any macros for functions defined in this module */
  23. #undef    getbegy
  24. #undef    getbegx
  25. #undef    getmaxy
  26. #undef    getmaxx
  27. #undef    getpary
  28. #undef    getparx
  29.  
  30. /* undefine any macros for functions called by this module if in debug mode */
  31. #ifdef PDCDEBUG
  32. #endif
  33.  
  34. #ifdef PDCDEBUG
  35. char *rcsid_getyx  = "$Id$";
  36. #endif
  37.  
  38. /*man-start*********************************************************************
  39.  
  40.   Name:                                                         getyx
  41.  
  42.   Synopsis:
  43.       void getyx(WINDOW *win, int y, int x);
  44.       void getparyx(WINDOW *win, int y, int x);
  45.       void getbegyx(WINDOW *win, int y, int x);
  46.       void getmaxyx(WINDOW *win, int y, int x);
  47.  
  48.       int getbegy(WINDOW *win);
  49.       int getbegx(WINDOW *win);
  50.       int getpary(WINDOW *win);
  51.       int getparx(WINDOW *win);
  52.       int getmaxy(WINDOW *win);
  53.       int getmaxx(WINDOW *win);
  54.  
  55.   X/Open Description:
  56.      With the getyx() macro, the cursor position of the window is placed
  57.      in the two integer variables y and x. getbegyx() and getmaxyx()
  58.      return the current beginning coordinates and size of the specified
  59.      window respectively. getparyx() returns the beginning coordinates 
  60.      of the parent's window if the specified window is a sub-window
  61.      otherwise -1 is returned.
  62.  
  63.      These functions are implemented as macros, so their return values
  64.      are undefined. Also as these functions are implemented as macros,
  65.      no '&' is required before the variables y and x.
  66.  
  67.      The functions getbegy(), getbegx(), getmaxy(), getmaxx() ,
  68.      getpary(), and getparx() do return the beginning coordinate or 
  69.      size values, so they can be specified on the right-hand side of 
  70.      an assignment statement. They are, however, implemented as macros.
  71.  
  72.   X/Open Errors:
  73.      No errors are defined for this function.
  74.  
  75.   Portability                             X/Open    BSD    SYS V
  76.                                           Dec '88
  77.       getyx                                 Y        Y       Y
  78.       getparyx                              -        -      4.0
  79.       getbegyx                              -        -      3.0
  80.       getmaxyx                              -        -      3.0
  81.       getbegy                               -        -       -
  82.       getbegx                               -        -       -
  83.       getpary                               -        -       -
  84.       getparx                               -        -       -
  85.       getmaxy                               -        -       -
  86.       getmaxx                               -        -       -
  87.  
  88. **man-end**********************************************************************/
  89.  
  90. /***********************************************************************/
  91. int    getbegy(WINDOW *win)
  92. /***********************************************************************/
  93. {
  94. #ifdef PDCDEBUG
  95.     if (trace_on) PDC_debug("getbegy() - called\n");
  96. #endif
  97.  
  98.     if (win == (WINDOW *)NULL)
  99.         return( ERR );
  100.  
  101.     return(win->_begy);
  102. }
  103. /***********************************************************************/
  104. int    getbegx(WINDOW *win)
  105. /***********************************************************************/
  106. {
  107. #ifdef PDCDEBUG
  108.     if (trace_on) PDC_debug("getbegx() - called\n");
  109. #endif
  110.  
  111.     if (win == (WINDOW *)NULL)
  112.         return( ERR );
  113.  
  114.     return(win->_begx);
  115. }
  116. /***********************************************************************/
  117. int    getpary(WINDOW *win)
  118. /***********************************************************************/
  119. {
  120. #ifdef PDCDEBUG
  121.     if (trace_on) PDC_debug("getpary() - called\n");
  122. #endif
  123.  
  124.     if (win == (WINDOW *)NULL)
  125.         return( ERR );
  126.  
  127.     return(win->_pary);
  128. }
  129. /***********************************************************************/
  130. int    getparx(WINDOW *win)
  131. /***********************************************************************/
  132. {
  133. #ifdef PDCDEBUG
  134.     if (trace_on) PDC_debug("getparx() - called\n");
  135. #endif
  136.  
  137.     if (win == (WINDOW *)NULL)
  138.         return( ERR );
  139.  
  140.     return(win->_parx);
  141. }
  142. /***********************************************************************/
  143. int    getmaxy(WINDOW *win)
  144. /***********************************************************************/
  145. {
  146. #ifdef PDCDEBUG
  147.     if (trace_on) PDC_debug("getmaxy() - called\n");
  148. #endif
  149.  
  150.     if (win == (WINDOW *)NULL)
  151.         return( ERR );
  152.  
  153.     return(win->_maxy);
  154. }
  155. /***********************************************************************/
  156. int    getmaxx(WINDOW *win)
  157. /***********************************************************************/
  158. {
  159. #ifdef PDCDEBUG
  160.     if (trace_on) PDC_debug("getmaxx() - called\n");
  161. #endif
  162.  
  163.     if (win == (WINDOW *)NULL)
  164.         return( ERR );
  165.  
  166.     return(win->_maxx);
  167. }
  168.